The best way to really learn any new programming language is to write programs with it. As you read through this guide and through the online function reference, you are encouraged to try out features as you learn about them. There are several ways to do this, which make it easy to experiment with VectorScript and learn about the language.
The most basic way to explore VectorScript is to take a VectorWorks document and export it using the Export VectorScript option. Once you have exported the document, use a text editor to open the document. What you will see is a VectorScript representation of the complete VectorWorks document: objects, layers, classes, document settings, and so on. You can compare this script code to the source document to see how a particular setting is created using VectorScript, or you can modify part of the script code and import it into a blank document to see how your changes affect the document. You can also use parts of this script code in your own scripts, either as-is or as a basis for your own custom work.
Another useful technique for exploring VectorScript is to make use of the Custom Tool/Attribute and Custom Selection commands of VectorWorks. These tool items make use of VectorScript to perform actions in VectorWorks, and you can use them to explore how to use VectorScript. The Custom Tool/Attribute command lets you save graphical attribute and tool settings for later use, and Custom Selection lets you define search criteria to select subsets of objects in your document. Both these techniques can be very useful when writing your own scripts, and you can see how to use these techniques by opening up the scripts and examining the script code.
Possibly the best technique is to start writing your own scripts from scratch. You can use the Resource Browser in VectorWorks to create blank document scripts and edit them through the VectorScript Editor. The VectorScript Editor provides several handy features which give you quick access to API information and other basics of the language.
While exploring VectorScript, you will probably write scripts which don’t execute, or don’t work as you expected. To correct problems which prevent your script from executing, you can check VectorScript's Error Output file, which will indicate the source of any fatal errors in your scripts. To correct problems which are preventing your script from working as desired, you can use the VectorScript debugger to trace through your code and locate the problem. You can also use the basic technique used by many other languages—insert statements which display the values of relevant variables in your script. VectorScript provides a convenient tool for this in the
Message() statement.